<? 
require_once('../include/connect.inc.php');
session_start();
 $_SESSION['S_ID']=1;
?>

<form name="form1" method="post" action="">
  <table width="720" border="1">
    <tr>
      <td width="82" align="center">ลำดับที่</td>
      <td width="252" align="left">ภาคการศึกษา</td>
      <td width="364">&nbsp;</td>
    </tr>
    <?  	$query = query("SELECT * FROM tb_set_of_test,tb_semester where tb_set_of_test.semester_id=tb_semester.semester_id");
		while ($rs = fetch_array($query)) {
		$set_id = $rs['set_id'];
		$semester_detail = $rs['semester_detail'];
	 	$count++;  ?>
    <tr>
      <td align="center"><? echo $count;?></td>
      <td><? echo $rs['semester_detail']; ?></td>
      <td>
      <? 
	  $query2 = query("SELECT * FROM tb_dotest,tb_set_of_test where tb_dotest.set_id=tb_set_of_test.set_id and tb_set_of_test.semester_id='".$rs['semester_detail']."'and student_id='".$_SESSION['S_ID']."'");
		while ($rs = fetch_array($query2)) {
		$dotest_id = $rs['dotest_id'];
	  
	  ?><button onclick="popupModal('test.php?id_suites=<? echo $set_id; ?>',1000,500);"><? echo$rs['semester_detail'];?></button>
      <? } ?></td>
    </tr><? } ?>
  </table>
</form>
